<template>
	<view class="income-wrap" v-if="incomeInfo">
		<view class="income-balance">
			<u-title value="我的收入余额"></u-title>
			<view class="bd2">
				<view class="txt2">¥&nbsp;{{ incomeInfo.balance }}</view>
				<view style="display: flex;flex-direction: column;">
					<view class="word2" style="margin-bottom: 16rpx;" @click="gotoRouter('/pages-agencies/withdrawList/withdrawList?busType=11')">提现记录</view>
					<view class="word2" @click="gotoRouter('/pages-agencies/WithdrawRequest/WithdrawRequest?amount=' + incomeInfo.balance + '&busType=11')">立即提现</view>
				</view>
			</view>
		</view>

		<view class="income-data">
			<u-title value="累计数据"></u-title>
			<view class="block2">
				<view class="outer6">
					<view class="txt4">{{ incomeInfo.orderNum }}</view>
					<view class="word3">总订单数</view>
				</view>
				<view class="outer7"></view>
				<view class="outer6">
					<view decode="true" class="txt4">¥&nbsp;{{ incomeInfo.sumBalance }}</view>
					<view class="word3">总收入金额</view>
				</view>
			</view>
		</view>

		<view class="income-record" v-if="monthlyRecord.length != 0">
			<view class="income-record-title">
				<u-title value="结算记录"></u-title>
			</view>

			<view class="income-record-list">
				<view class="income-record-item" v-for="(item, index) in monthlyRecord" :key="index" @click="gotoRouter('/pages-doctor/settleSecord/settleSecord?id=' + item.id)">
					<view class="record-item-left">
						<view class="record-item-date">{{ item.startTime }}</view>
						<view class="record-item-date">~</view>
						<view class="record-item-date">{{ item.endTime }}</view>
					</view>

					<view class="record-item-info">
						<view class="main3">
							<view class="info3">交易金额</view>
							<view decode="true" class="info4">&nbsp;¥&nbsp;{{ item.actualOrderAmount }}</view>
						</view>
						<view class="main3">
							<view class="info3">到账金额</view>
							<view decode="true" class="info4">&nbsp;¥&nbsp;{{ item.actualArriveAmount }}</view>
						</view>
						<view class="info5">手续费：{{ item.totalHandlingFee }} &nbsp;&nbsp;订单数：{{ item.orderNum }}</view>
						<view class="info5"></view>
					</view>
				</view>
			</view>

			
		</view>
	</view>
</template>

<script>
import uTitle from '@/components/u-title/u-title.vue';
export default {
	components: {
		uTitle
	},
	data() {
		return {
			incomeInfo: null,
			monthlyRecord: [], //结算记录
			
		};
	},
	onLoad(option) {
		this.getIncomeDetail();
		this.doctorMonthlyRecord();
	},
	onShow() {},
	methods: {
		//收入概览
		getIncomeDetail() {
			this.$api.getIncomeDetail({}).then(res => {
				if (res.code == 200) {
					this.incomeInfo = res.result;
				}
			});
		},

		//结算记录列表
		doctorMonthlyRecord() {
			this.$api
				.doctorMonthlyRecord({
					params: {
						pageSize: 999
					}
				})
				.then(res => {
					if (res.code == 200) {
						res.result.records.forEach(key => {
							key.startTime = key.startTime.substr(0, 10);
							key.endTime = key.endTime.substr(0, 10);
						});
						this.monthlyRecord = res.result.records;
					}
				});
		},
		
	
		
	}
};
</script>

<style lang="less">
@import './income.less';
</style>
